# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: François Charette <francois ατ archlinux δοτ org>
# Contributor: Jason Chu <jchu@xentac.net>
# Contributor: Juergen Hoetzel <juergen@archlinux.org>

pkgname=perl-tk
pkgver=804.036
pkgrel=3
pkgdesc="A graphical user interface toolkit for Perl"
arch=('x86_64')
url="https://search.cpan.org/dist/Tk"
license=('PerlArtistic' 'GPL' 'custom')
depends=('libpng' 'libjpeg' 'libx11' 'perl')
checkdepends=('xorg-server-xvfb' 'perl-devel-leak' 'perl-test-pod' 'ttf-font')
options=('!emptydirs' '!strip')
source=("https://www.cpan.org/authors/id/S/SR/SREZIC/Tk-$pkgver.tar.gz")
sha512sums=('7d8b82127a5fdbb2f0387f541af8844a09f1230f377b92d511ecb12e81bfd5ef56d4fe925cac064a798a96a003bb8465b6df37cff18a960f3631bb3a214cd812')

build() {
  cd Tk-$pkgver

  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd Tk-$pkgver
  xvfb-run make -j1 test
}

package() {
  cd Tk-$pkgver
  make install DESTDIR="$pkgdir"

  # license
  install -D -m644 pTk/license.terms \
                   "$pkgdir"/usr/share/licenses/$pkgname/tk.license
  install -D -m644 pTk/Tix.license \
                   "$pkgdir"/usr/share/licenses/$pkgname/tix.license
}
